<%--
  login.jsp
  作用：用户登录页面，提供用户输入用户名和密码进行登录的功能。
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录 - 沈阳工程学院二手交易</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/style.css">
</head>
<body>

    <div class="background-text">沈阳工程学院二手交易</div>

    <div class="login-container">
        <div class="login-box">
            <h2>用户登录</h2>
            <form action="${pageContext.request.contextPath}/login" method="post">
                <div class="input-group">
                    <label for="username">用户名</label>
                    <input type="text" id="username" name="username" required>
                </div>
                <div class="input-group">
                    <label for="password">密码</label>
                    <input type="password" id="password" name="password" required>
                </div>
                
                <%-- 显示错误消息 --%>
                <%
                    String error = (String) request.getAttribute("error");
                    if (error != null && !error.isEmpty()) {
                %>
                    <p class="error-message"><%= error %></p>
                <%
                    }
                %>
                
                <button type="submit" class="btn">登录</button>
            </form>
            <div class="extra-links">
                <a href="${pageContext.request.contextPath}/register.jsp">还没账号？去注册</a>
            </div>
        </div>
    </div>

</body>
</html> 